<?php
function connect() {
    $dbHandler = mysql_connect("localhost", "root", "");
    if (!$dbHandler) {
        echo "Connection Failed";
    }
    return $dbHandler;
}

function selectDb($dbName) {

    $selected = mysql_select_db($dbName, connect());
    if (!$selected) {
        echo "No such a database exists";
    }
    return $selected;
}

function disconnect() {
    mysql_close();
}

function runQuery($sqlString) {
    $dataset = mysql_query($sqlString);
    disconnect();
    return $dataset;
}

?>